let app = Shell.AppSystem.get_default().lookup_app(appId);
- Main.overview.setMessage(_("%s has been added to your favorites.").format(app.get_name()), Lang.bind(this, function () {
- this._removeFavorite(appId);
- }));
+ Main.overview.setMessage(_("%s has been added to your favorites.").format(app.get_name()),
+ { forFeedback: true,
+ undoCallback: Lang.bind(this, function () {
+ this._removeFavorite(appId);
+ })
+ });
},
addFavorite: function(appId) {
return;
Main.overview.setMessage(_("%s has been removed from your favorites.").format(app.get_name()),
- Lang.bind(this, function () {
- this._addFavorite(appId, pos);
- }));
+ { forFeedback: true,
+ undoCallback: Lang.bind(this, function () {
+ this._addFavorite(appId, pos);
+ })
+ });
}
});
Signals.addSignalMethods(AppFavorites.prototype);
this.resident = false;
// 'transient' is a reserved keyword in JS, so we have to use an alternate variable name
this.isTransient = false;
+ this.forFeedback = false;
this.expanded = false;
this.focused = false;
this.acknowledged = false;
this.isTransient = isTransient;
},
+ setForFeedback: function(forFeedback) {
+ this.forFeedback = forFeedback;
+ },
+
setUseActionIcons: function(useIcons) {
this._useActionIcons = useIcons;
},
// Notifications
let notificationQueue = this._notificationQueue;
let notificationUrgent = notificationQueue.length > 0 && notificationQueue[0].urgency == Urgency.CRITICAL;
+ let notificationForFeedback = notificationQueue.length > 0 && notificationQueue[0].forFeedback;
let notificationsLimited = this._busy || this._inFullscreen;
- let notificationsPending = notificationQueue.length > 0 && (!notificationsLimited || notificationUrgent) && Main.sessionMode.hasNotifications;
+ let notificationsPending = notificationQueue.length > 0 && (!notificationsLimited || notificationUrgent || notificationForFeedback) && Main.sessionMode.hasNotifications;
let nextNotification = notificationQueue.length > 0 ? notificationQueue[0] : null;
let notificationPinned = this._pointerInTray && !this._pointerInSummary && !this._notificationRemoved;
let notificationExpanded = this._notification && this._notification.expanded;
this._source.destroy();
},
- setMessage: function(text, undoCallback, undoLabel) {
+ setMessage: function(text, options) {
+ options = Params.parse(options, { undoCallback: null,
+ forFeedback: false
+ });
+
+ let undoCallback = options.undoCallback;
+ let forFeedback = options.forFeedback;
+
if (this._source == null) {
this._source = new MessageTray.SystemNotificationSource();
this._source.connect('destroy', Lang.bind(this,
if (this._source.notifications.length == 0) {
notification = new MessageTray.Notification(this._source, text, null);
notification.setTransient(true);
+ notification.setForFeedback(forFeedback);
} else {
notification = this._source.notifications[0];
notification.update(text, null, { clear: true });
this._undoCallback = undoCallback;
if (undoCallback) {
- notification.addButton('system-undo',
- undoLabel ? undoLabel : _("Undo"));
- notification.connect('action-invoked',
- Lang.bind(this, this._onUndoClicked));
+ notification.addButton('system-undo', _("Undo"));
+ notification.connect('action-invoked', Lang.bind(this, this._onUndoClicked));
}
this._source.notify(notification);
this._viewSelector.removeSearchProvider(provider);
},
- setMessage: function(text, undoCallback, undoLabel) {
+ //
+ // options:
+ // - undoCallback (function): the callback to be called if undo support is needed
+ // - forFeedback (boolean): whether the message is for direct feedback of a user action
+ //
+ setMessage: function(text, options) {
if (this.isDummy)
return;
- this._shellInfo.setMessage(text, undoCallback, undoLabel);
+ this._shellInfo.setMessage(text, options);
},
_onDragBegin: function() {
let [title, banner] = this._getTitleAndBanner(app, window);
let notification = new MessageTray.Notification(source, title, banner);
+ notification.setForFeedback(true);
+
source.notify(notification);
source.signalIDs.push(window.connect('notify::title', Lang.bind(this, function() {